<%@ page contentType="text/html; charset=GBK"  %><%@page import="java.util.*"%><%@page import="com.ionglobal.db.*" %><%@page import="com.ionglobal.misc.*" %><%@page import="com.ionglobal.lib.*" %><%@page import="com.gzgi.weqs.refquote.*" %><%@page import="com.gzgi.weqs.partsmanage.*" %><%@page import="org.json.*"%><%@ include file="/include/init_include.jsp" %><%
	Sysop me = (Sysop)session.getAttribute("sysop");
	if(session.getAttribute("ReqBuild")==null){
		return;
	}
	
	ReqApp reqApp = new ReqApp();
	ReqItemApp itemApp = new ReqItemApp();
	Req req = (Req)session.getAttribute("ReqBuild");
	Map wherecause = (Map)session.getAttribute("ReqBuildMap");
	JSONObject jsonObject = new JSONObject();
	
	if(reqApp.insertReq(dbi, req)){
		if(!itemApp.bulidReqItem(dbi, req, wherecause)){
			reqApp.deleteReq(dbi, req.getId());
			jsonObject.put("errorCode", "2");
		}else
			jsonObject.put("errorCode", "1");
	}
	out.print(jsonObject);
	System.out.println(jsonObject);
	
	session.removeAttribute("ReqBuild");
	session.removeAttribute("ReqBuildData");
	session.removeAttribute("ReqBuildMap");
	
%><%@ include file="/include/init_free.jsp" %>